import tkinter as tk
from tkinter import messagebox, ttk
import random
import json
from datetime import datetime
import time

class EnhancedCoupleMonopoly:
    def __init__(self):
        self.root = tk.Tk()
        self.root.title("💕 情侣大富翁 - 爱情冒险版 💕")
        self.root.geometry("1400x900")
        self.root.configure(bg='#ffeef8')
        
        # 游戏状态
        self.current_player = 0
        self.game_round = 1
        self.players = [
            {
                "name": "💖 甜心", "money": 15000, "position": 0, "properties": [], 
                "cards": [], "love_points": 100, "achievements": [], "special_effects": [],
                "relationship_level": 1, "avatar": "💖", "color": "#ff69b4"
            },
            {
                "name": "💙 宝贝", "money": 15000, "position": 0, "properties": [], 
                "cards": [], "love_points": 100, "achievements": [], "special_effects": [],
                "relationship_level": 1, "avatar": "💙", "color": "#4169e1"
            }
        ]
        
        # 棋盘设置
        self.board_size = 20
        self.properties = self.init_enhanced_properties()
        self.chance_cards = self.init_enhanced_chance_cards()
        self.fate_cards = self.init_enhanced_fate_cards()
        self.love_tasks = self.init_love_tasks()
        self.achievements = self.init_achievements()
        
        # 天气和季节系统
        self.weather = random.choice(["☀️晴天", "🌧️雨天", "❄️雪天", "🌸春天", "🍂秋天"])
        self.season_effect = self.get_season_effect()
        
        # 游戏统计
        self.game_stats = {"rounds": 0, "properties_bought": 0, "love_tasks_completed": 0}
        
        # 游戏记录
        self.game_log = []
        
        # 设置UI
        self.setup_enhanced_ui()
        
    def init_enhanced_properties(self):
        """初始化增强版地块"""
        properties = [
            {"name": "💕 起点", "type": "start", "price": 0, "rent": 0, "owner": None, "level": 0, 
             "special_effect": "经过获得2000元和10爱情值", "love_bonus": 10, "linked_properties": []},
            {"name": "🌹 玫瑰花园", "type": "property", "price": 6000, "rent": 500, "owner": None, "level": 0,
             "special_effect": "浪漫加成", "love_bonus": 15, "linked_properties": [3, 8]},
            {"name": "🎁 机会", "type": "chance", "price": 0, "rent": 0, "owner": None, "level": 0,
             "special_effect": "抽取机会卡", "love_bonus": 0, "linked_properties": []},
            {"name": "🏖️ 海滨别墅", "type": "property", "price": 8000, "rent": 700, "owner": None, "level": 0,
             "special_effect": "度假胜地", "love_bonus": 20, "linked_properties": [1, 15]},
            {"name": "💰 爱情基金", "type": "tax", "price": 0, "rent": 1000, "owner": None, "level": 0,
             "special_effect": "缴纳爱情税", "love_bonus": 0, "linked_properties": []},
            {"name": "🚗 浪漫车站", "type": "station", "price": 4000, "rent": 300, "owner": None, "level": 0,
             "special_effect": "快速移动", "love_bonus": 5, "linked_properties": [10, 15]},
            {"name": "🎭 剧院约会", "type": "property", "price": 7000, "rent": 600, "owner": None, "level": 0,
             "special_effect": "文艺加成", "love_bonus": 18, "linked_properties": [8, 12]},
            {"name": "🔮 命运", "type": "fate", "price": 0, "rent": 0, "owner": None, "level": 0,
             "special_effect": "抽取命运卡", "love_bonus": 0, "linked_properties": []},
            {"name": "🍽️ 烛光晚餐", "type": "property", "price": 9000, "rent": 800, "owner": None, "level": 0,
             "special_effect": "美食加成", "love_bonus": 25, "linked_properties": [1, 6]},
            {"name": "💎 珠宝店", "type": "property", "price": 12000, "rent": 1200, "owner": None, "level": 0,
             "special_effect": "奢华加成", "love_bonus": 30, "linked_properties": [11, 17]},
            {"name": "🚁 直升机场", "type": "station", "price": 4000, "rent": 300, "owner": None, "level": 0,
             "special_effect": "空中旅行", "love_bonus": 5, "linked_properties": [5, 15]},
            {"name": "🏰 城堡酒店", "type": "property", "price": 15000, "rent": 1500, "owner": None, "level": 0,
             "special_effect": "皇室体验", "love_bonus": 35, "linked_properties": [9, 18]},
            {"name": "🎪 游乐园", "type": "property", "price": 10000, "rent": 1000, "owner": None, "level": 0,
             "special_effect": "欢乐加成", "love_bonus": 22, "linked_properties": [6, 14]},
            {"name": "🎁 机会", "type": "chance", "price": 0, "rent": 0, "owner": None, "level": 0,
             "special_effect": "抽取机会卡", "love_bonus": 0, "linked_properties": []},
            {"name": "🎢 摩天轮", "type": "property", "price": 11000, "rent": 1100, "owner": None, "level": 0,
             "special_effect": "浪漫高度", "love_bonus": 28, "linked_properties": [12, 16]},
            {"name": "⛵ 游艇码头", "type": "station", "price": 4000, "rent": 300, "owner": None, "level": 0,
             "special_effect": "海上之旅", "love_bonus": 5, "linked_properties": [3, 5, 10]},
            {"name": "🌙 月光露台", "type": "property", "price": 13000, "rent": 1300, "owner": None, "level": 0,
             "special_effect": "月夜浪漫", "love_bonus": 32, "linked_properties": [14, 18]},
            {"name": "🔮 命运", "type": "fate", "price": 0, "rent": 0, "owner": None, "level": 0,
             "special_effect": "抽取命运卡", "love_bonus": 0, "linked_properties": []},
            {"name": "💒 教堂", "type": "property", "price": 20000, "rent": 2000, "owner": None, "level": 0,
             "special_effect": "神圣祝福", "love_bonus": 50, "linked_properties": [11, 16]},
            {"name": "💸 奢侈税", "type": "tax", "price": 0, "rent": 2000, "owner": None, "level": 0,
             "special_effect": "缴纳奢侈税", "love_bonus": 0, "linked_properties": []}
        ]
        return properties
    
    def init_enhanced_chance_cards(self):
        """初始化增强版机会卡"""
        return [
            {"text": "💕 爱情大爆发！获得3000元和50爱情值！", "effect": "money", "value": 3000, "love_bonus": 50},
            {"text": "🎁 收到神秘礼物！获得一张随机道具卡！", "effect": "card", "value": 1, "love_bonus": 10},
            {"text": "🌟 幸运之星！前进到任意地块！", "effect": "teleport", "value": 0, "love_bonus": 20},
            {"text": "💸 意外支出！支付1500元！", "effect": "money", "value": -1500, "love_bonus": 0},
            {"text": "🎊 双倍收益！下次收租翻倍！", "effect": "special", "value": "租金翻倍", "love_bonus": 15},
            {"text": "🏠 免费升级！随机升级一个地产！", "effect": "upgrade", "value": 1, "love_bonus": 25},
            {"text": "💎 关系升级！关系等级+1！", "effect": "relationship", "value": 1, "love_bonus": 30},
            {"text": "🌈 彩虹祝福！所有玩家获得爱情值！", "effect": "all_love", "value": 20, "love_bonus": 20}
        ]
    
    def init_enhanced_fate_cards(self):
        """初始化增强版命运卡"""
        return [
            {"text": "💔 感情危机！失去2000元和30爱情值！", "effect": "money", "value": -2000, "love_bonus": -30},
            {"text": "🎭 角色互换！与对方交换位置！", "effect": "swap", "value": 0, "love_bonus": 0},
            {"text": "🌙 月圆之夜！所有地产升级一级！", "effect": "special", "value": "全体升级", "love_bonus": 40},
            {"text": "💰 意外之财！获得5000元！", "effect": "money", "value": 5000, "love_bonus": 0},
            {"text": "🎪 时光倒流！回到起点！", "effect": "position", "value": 0, "love_bonus": 10},
            {"text": "🔄 重新开始！选择重置一项属性！", "effect": "reset", "value": 0, "love_bonus": 0},
            {"text": "✨ 特殊事件触发！", "effect": "special_event", "value": 0, "love_bonus": 0},
            {"text": "💕 爱情奇迹！获得100爱情值！", "effect": "love", "value": 100, "love_bonus": 100}
        ]
    
    def init_love_tasks(self):
        """初始化爱情任务"""
        return [
            {"name": "💏 甜蜜拥抱", "desc": "在游戏中拥抱对方", "reward": 50, "completed": False},
            {"name": "🌹 送花表白", "desc": "购买玫瑰花园时表白", "reward": 80, "completed": False},
            {"name": "💍 求婚仪式", "desc": "在教堂地块求婚", "reward": 200, "completed": False},
            {"name": "🍽️ 浪漫晚餐", "desc": "在烛光晚餐地块用餐", "reward": 60, "completed": False},
            {"name": "🎭 看戏约会", "desc": "一起在剧院看演出", "reward": 70, "completed": False},
            {"name": "🎢 游乐园约会", "desc": "在游乐园一起玩耍", "reward": 90, "completed": False}
        ]
    
    def init_achievements(self):
        """初始化成就系统"""
        return [
            {"name": "💰 小富翁", "desc": "拥有30000元", "condition": "money", "value": 30000, "unlocked": False},
            {"name": "🏠 地产大亨", "desc": "拥有5块地产", "condition": "properties", "value": 5, "unlocked": False},
            {"name": "💕 爱情达人", "desc": "获得500爱情值", "condition": "love", "value": 500, "unlocked": False},
            {"name": "💑 完美情侣", "desc": "关系等级达到5级", "condition": "level", "value": 5, "unlocked": False},
            {"name": "🎯 任务专家", "desc": "完成3个爱情任务", "condition": "tasks", "value": 3, "unlocked": False}
        ]
    
    def get_season_effect(self):
        """获取季节效果"""
        effects = {
            "☀️晴天": "所有收益+20%",
            "🌧️雨天": "移动距离-1",
            "❄️雪天": "升级费用减半",
            "🌸春天": "爱情值获得翻倍",
            "🍂秋天": "地产价格-10%"
        }
        return effects.get(self.weather, "无特殊效果")
    
    def setup_enhanced_ui(self):
        """设置增强版UI"""
        # 主框架
        main_frame = tk.Frame(self.root, bg='#ffeef8')
        main_frame.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
        
        # 顶部状态栏
        self.setup_status_bar(main_frame)
        
        # 中间内容区域
        content_frame = tk.Frame(main_frame, bg='#ffeef8')
        content_frame.pack(fill=tk.BOTH, expand=True, pady=10)
        
        # 左侧棋盘
        self.setup_enhanced_board(content_frame)
        
        # 右侧信息面板
        self.setup_info_panel(content_frame)
        
        # 底部控制面板
        self.setup_control_panel(main_frame)
    
    def setup_status_bar(self, parent):
        """设置状态栏"""
        status_frame = tk.Frame(parent, bg='#ff1493', height=80)
        status_frame.pack(fill=tk.X, pady=(0, 10))
        status_frame.pack_propagate(False)
        
        # 当前玩家指示器 - 更大更显眼
        self.current_player_indicator = tk.Label(status_frame, 
            text=f"🎯 轮到: {self.players[self.current_player]['name']}",
            font=('Arial', 20, 'bold'), bg='#ff1493', fg='white')
        self.current_player_indicator.pack(side=tk.LEFT, padx=20, pady=20)
        
        # 回合数
        self.round_label = tk.Label(status_frame, text=f"第 {self.game_round} 回合",
            font=('Arial', 16, 'bold'), bg='#ff1493', fg='white')
        self.round_label.pack(side=tk.LEFT, padx=20, pady=20)
        
        # 当前玩家道具显示
        self.current_player_items = tk.Label(status_frame, text="",
            font=('Arial', 14, 'bold'), bg='#ff1493', fg='yellow')
        self.current_player_items.pack(side=tk.LEFT, padx=20, pady=20)
        
        # 天气显示
        self.weather_label = tk.Label(status_frame, text=f"天气: {self.weather}",
            font=('Arial', 16, 'bold'), bg='#ff1493', fg='white')
        self.weather_label.pack(side=tk.RIGHT, padx=20, pady=20)
    
    def setup_enhanced_board(self, parent):
        """设置增强版棋盘"""
        board_frame = tk.Frame(parent, bg='#ffeef8')
        board_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=(0, 10))
        
        # 棋盘画布
        self.board_canvas = tk.Canvas(board_frame, width=700, height=700, bg='#e8f5e8')
        self.board_canvas.pack(pady=10)
        
        # 绑定点击事件
        self.board_canvas.bind("<Button-1>", self.on_board_click)
        
        # 绘制棋盘
        self.draw_enhanced_board()
    
    def setup_info_panel(self, parent):
        """设置信息面板"""
        info_frame = tk.Frame(parent, bg='#ffeef8', width=400)
        info_frame.pack(side=tk.RIGHT, fill=tk.Y)
        info_frame.pack_propagate(False)
        
        # 创建标签页
        notebook = ttk.Notebook(info_frame)
        notebook.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
        
        # 玩家信息页
        self.setup_player_info_tab(notebook)
        
        # 成就页
        self.setup_achievements_tab(notebook)
        
        # 游戏记录页
        self.setup_game_log_tab(notebook)
    
    def setup_player_info_tab(self, notebook):
        """设置玩家信息标签页"""
        player_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(player_frame, text="👥 玩家信息")
        
        self.player_info_frames = []
        
        for i, player in enumerate(self.players):
            # 玩家框架
            frame = tk.LabelFrame(player_frame, text=f"{player['avatar']} {player['name']}", 
                                 bg='white', font=('Arial', 12, 'bold'), fg=player['color'])
            frame.pack(fill=tk.X, padx=10, pady=10)
            
            # 玩家信息文本
            info_text = tk.Text(frame, height=6, font=('Arial', 10), bg='#f9f9f9', wrap=tk.WORD)
            info_text.pack(fill=tk.X, padx=10, pady=10)
            
            self.player_info_frames.append(info_text)
    
    def setup_achievements_tab(self, notebook):
        """设置成就标签页"""
        achievement_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(achievement_frame, text="🏆 成就")
        
        tk.Label(achievement_frame, text="🏆 成就系统 🏆", 
                font=('Arial', 14, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=10)
        
        # 成就列表
        self.achievement_text = tk.Text(achievement_frame, font=('Arial', 10), bg='white', wrap=tk.WORD)
        self.achievement_text.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
    
    def setup_game_log_tab(self, notebook):
        """设置游戏记录标签页"""
        log_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(log_frame, text="📝 游戏记录")
        
        tk.Label(log_frame, text="📝 游戏记录 📝", 
                font=('Arial', 14, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=10)
        
        # 游戏记录文本框
        log_scroll_frame = tk.Frame(log_frame)
        log_scroll_frame.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
        
        self.log_text = tk.Text(log_scroll_frame, font=('Arial', 9), bg='white', wrap=tk.WORD)
        log_scrollbar = tk.Scrollbar(log_scroll_frame, orient=tk.VERTICAL, command=self.log_text.yview)
        self.log_text.configure(yscrollcommand=log_scrollbar.set)
        
        self.log_text.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
        log_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
    
    def setup_control_panel(self, parent):
        """设置控制面板"""
        control_frame = tk.Frame(parent, bg='#ffeef8', height=200)
        control_frame.pack(fill=tk.X, pady=(10, 0))
        control_frame.pack_propagate(False)
        
        # 情侣轮盘区域
        roulette_frame = tk.Frame(control_frame, bg='#ffeef8')
        roulette_frame.pack(side=tk.LEFT, padx=20, pady=10)
        
        # 轮盘标题
        tk.Label(roulette_frame, text="💕 情侣命运轮盘 💕", 
                font=('Arial', 16, 'bold'), bg='#ffeef8', fg='#ff1493').pack(pady=2)
        
        # 转动轮盘按钮 - 移到最上方，更显眼的设计
        roll_button = tk.Button(roulette_frame, text="🎲 掷骰子 🎲", command=self.spin_couple_roulette,
                               font=('Arial', 18, 'bold'), bg='#ff1493', fg='white', 
                               width=14, height=2, relief='raised', bd=4)
        roll_button.pack(pady=8)
        
        # 轮盘显示区域
        self.roulette_display = tk.Label(roulette_frame, text="🎡", 
                                        font=('Arial', 48), bg='#ffeef8')
        self.roulette_display.pack(pady=5)
        
        # 骰子显示（保留原有功能）
        self.dice_display = tk.Label(roulette_frame, text="🎲🎲", 
                                    font=('Arial', 32), bg='#ffeef8')
        self.dice_display.pack(pady=2)
        
        # 结果显示
        self.dice_result = tk.Label(roulette_frame, text="等待转动轮盘...", 
                                   font=('Arial', 14, 'bold'), bg='#ffeef8', fg='#ff69b4')
        self.dice_result.pack(pady=2)
        
        # 特殊效果显示
        self.special_effect_display = tk.Label(roulette_frame, text="", 
                                              font=('Arial', 12), bg='#ffeef8', fg='#9932cc', wraplength=250)
        self.special_effect_display.pack(pady=2)
        
        # 添加额外的轮盘按钮（保持原功能）
        roulette_button = tk.Button(roulette_frame, text="🎡 情侣轮盘", command=self.spin_couple_roulette,
                                   font=('Arial', 12), bg='#ff69b4', fg='white', 
                                   width=12, height=1)
        roulette_button.pack(pady=2)
        
        # 操作按钮区域
        button_frame = tk.Frame(control_frame, bg='#ffeef8')
        button_frame.pack(side=tk.RIGHT, padx=20, pady=10)
        
        buttons = [
            ("📊 查看资产", self.view_enhanced_assets),
            ("🎴 使用道具", self.use_enhanced_items),
            ("🏠 管理地产", self.manage_enhanced_properties),
            ("📈 游戏统计", self.show_game_stats),
            ("⚙️ 游戏设置", self.show_game_settings),
            ("🔄 重新开始", self.enhanced_restart_game)
        ]
        
        for text, command in buttons:
            btn = tk.Button(button_frame, text=text, command=command,
                           font=('Arial', 10), bg='#2196F3', fg='white', width=12)
            btn.pack(pady=2)
    
    def draw_enhanced_board(self):
        """绘制增强版棋盘"""
        self.board_canvas.delete("all")
        
        # 绘制渐变背景
        for i in range(700):
            color_intensity = int(232 + (255-232) * (i/700))
            color = f"#{color_intensity:02x}{color_intensity:02x}{color_intensity:02x}"
            self.board_canvas.create_line(0, i, 700, i, fill=color)
        
        # 绘制中心装饰
        center_x, center_y = 350, 350
        self.board_canvas.create_oval(center_x-100, center_y-100, center_x+100, center_y+100, 
                                     fill='#ffb6c1', outline='#ff69b4', width=3)
        self.board_canvas.create_text(center_x, center_y-20, text="💕 情侣大富翁 💕", 
                                     font=('Arial', 16, 'bold'), fill='#ff1493')
        self.board_canvas.create_text(center_x, center_y+20, text="爱情冒险版", 
                                     font=('Arial', 12, 'bold'), fill='#ff1493')
        
        # 绘制地块
        self.draw_enhanced_properties()
        
        # 绘制玩家位置
        self.update_enhanced_player_positions()
    
    def get_enhanced_board_positions(self):
        """获取增强版棋盘位置"""
        positions = []
        board_width, board_height = 700, 700
        margin = 50
        
        # 计算每边的地块数
        side_length = 5
        
        # 底边 (从右到左)
        for i in range(side_length):
            x = board_width - margin - i * (board_width - 2*margin) // (side_length - 1)
            y = board_height - margin
            positions.append((x, y))
        
        # 左边 (从下到上)
        for i in range(1, side_length):
            x = margin
            y = board_height - margin - i * (board_height - 2*margin) // (side_length - 1)
            positions.append((x, y))
        
        # 上边 (从左到右)
        for i in range(1, side_length):
            x = margin + i * (board_width - 2*margin) // (side_length - 1)
            y = margin
            positions.append((x, y))
        
        # 右边 (从上到下)
        for i in range(1, side_length - 1):
            x = board_width - margin
            y = margin + i * (board_height - 2*margin) // (side_length - 1)
            positions.append((x, y))
        
        return positions
    
    def draw_enhanced_properties(self):
        """绘制增强版地块"""
        positions = self.get_enhanced_board_positions()
        
        for i, (x, y) in enumerate(positions):
            prop = self.properties[i]
            
            # 地块颜色
            if prop['type'] == 'start':
                color = '#ff69b4'
            elif prop['type'] == 'property':
                if prop['owner'] is not None:
                    color = self.players[prop['owner']]['color']
                else:
                    color = '#90EE90'
            elif prop['type'] == 'chance':
                color = '#FFD700'
            elif prop['type'] == 'fate':
                color = '#9370DB'
            elif prop['type'] == 'station':
                color = '#87CEEB'
            else:
                color = '#FFA500'
            
            # 绘制地块
            rect = self.board_canvas.create_rectangle(x-35, y-25, x+35, y+25, 
                                                     fill=color, outline='#333', width=2)
            
            # 地块名称 - 增大字体
            name_parts = prop['name'].split(' ', 1)
            if len(name_parts) > 1:
                self.board_canvas.create_text(x, y-10, text=name_parts[0], 
                                             font=('Arial', 12, 'bold'), fill='#333')
                self.board_canvas.create_text(x, y+5, text=name_parts[1], 
                                             font=('Arial', 10), fill='#333')
            else:
                self.board_canvas.create_text(x, y, text=prop['name'], 
                                             font=('Arial', 12, 'bold'), fill='#333')
            
            # 显示等级
            if prop['level'] > 0:
                level_text = "⭐" * prop['level']
                self.board_canvas.create_text(x, y+18, text=level_text, 
                                             font=('Arial', 8), fill='#ff4500')
            
            # 显示爱情加成
            if prop['love_bonus'] > 0:
                self.board_canvas.create_text(x+25, y-20, text=f"+{prop['love_bonus']}💕", 
                                             font=('Arial', 8), fill='#ff1493')
    
    def update_enhanced_player_positions(self):
        """更新增强版玩家位置"""
        positions = self.get_enhanced_board_positions()
        
        # 清除之前的玩家标记
        self.board_canvas.delete("player")
        
        for i, player in enumerate(self.players):
            if player['position'] < len(positions):
                x, y = positions[player['position']]
                
                # 调整位置避免重叠
                offset_x = -15 if i == 0 else 15
                offset_y = -10 if i == 0 else 10
                
                # 绘制玩家头像
                self.board_canvas.create_text(x + offset_x, y + offset_y, 
                                             text=player['avatar'], 
                                             font=('Arial', 16), 
                                             fill=player['color'], 
                                             tags="player")
    
    def spin_couple_roulette(self):
        """转动情侣轮盘"""
        current_player = self.players[self.current_player]
        other_player = self.players[1 - self.current_player]
        
        # 轮盘动画效果
        roulette_symbols = ["🎡", "💕", "💖", "💝", "💘", "💗", "💓", "💞"]
        for i in range(12):
            self.roulette_display.config(text=roulette_symbols[i % len(roulette_symbols)])
            self.root.update()
            time.sleep(0.15)
        
        # 掷骰子（保留原有移动机制）
        dice1 = random.randint(1, 6)
        dice2 = random.randint(1, 6)
        total = dice1 + dice2
        
        # 情侣轮盘特殊事件
        roulette_events = [
            {"name": "💕 甜蜜时光", "desc": "你们一起度过了美好时光！", "effect": "sweet_time", "probability": 15},
            {"name": "💔 小争吵", "desc": "因为小事发生了争吵...", "effect": "small_fight", "probability": 10},
            {"name": "🎁 惊喜礼物", "desc": "收到了对方的惊喜礼物！", "effect": "surprise_gift", "probability": 12},
            {"name": "💸 约会消费", "desc": "约会花费了一些钱...", "effect": "date_expense", "probability": 8},
            {"name": "💰 共同理财", "desc": "一起理财获得收益！", "effect": "joint_finance", "probability": 10},
            {"name": "🌹 浪漫表白", "desc": "浪漫的表白增进了感情！", "effect": "romantic_confession", "probability": 12},
            {"name": "🎭 角色扮演", "desc": "有趣的角色扮演游戏！", "effect": "role_play", "probability": 8},
            {"name": "🍽️ 烛光晚餐", "desc": "享受了浪漫的烛光晚餐！", "effect": "candlelight_dinner", "probability": 10},
            {"name": "💍 求婚惊喜", "desc": "模拟求婚的甜蜜时刻！", "effect": "proposal_surprise", "probability": 5},
            {"name": "🎪 游乐园约会", "desc": "在游乐园玩得很开心！", "effect": "amusement_park", "probability": 10}
        ]
        
        # 根据概率选择事件
        rand_num = random.randint(1, 100)
        cumulative_prob = 0
        selected_event = None
        
        for event in roulette_events:
            cumulative_prob += event["probability"]
            if rand_num <= cumulative_prob:
                selected_event = event
                break
        
        if not selected_event:
            selected_event = {"name": "🎲 普通移动", "desc": "正常的移动回合", "effect": "normal_move", "probability": 0}
        
        # 天气效果
        if self.weather == "🌧️雨天" and total > 1:
            total -= 1
            self.add_enhanced_log(f"🌧️ 雨天效果：移动距离-1")
        
        # 使用加速卡效果（自动使用）
        if "时间加速器" in current_player['cards']:
            total += 3
            current_player['cards'].remove("时间加速器")
            self.add_enhanced_log(f"⚡ {current_player['name']} 自动使用了时间加速器！骰子点数+3")
        
        # 更新显示
        self.roulette_display.config(text="💕")
        self.dice_display.config(text=f"🎲{dice1} 🎲{dice2}")
        self.dice_result.config(text=f"点数: {total}")
        self.special_effect_display.config(text=f"{selected_event['name']}\n{selected_event['desc']}")
        
        # 处理轮盘事件效果
        self.handle_roulette_event(selected_event, current_player, other_player)
        
        # 移动玩家
        old_position = current_player['position']
        current_player['position'] = (current_player['position'] + total) % self.board_size
        
        self.add_enhanced_log(f"🎡 {current_player['name']} 转动轮盘：{selected_event['name']}")
        self.add_enhanced_log(f"🎲 掷出了 {dice1}+{dice2}={total}，移动到 {self.properties[current_player['position']]['name']}")
        
        # 检查是否经过起点
        if current_player['position'] < old_position:
            current_player['money'] += 2000
            current_player['love_points'] += 10
            self.add_enhanced_log(f"💕 {current_player['name']} 经过起点，获得2000元和10爱情值！")
        
        # 处理当前位置事件
        self.handle_enhanced_position()
        
        # 检查成就
        self.check_achievements()
        
        # 更新显示
        self.update_enhanced_display()
        
        # 切换玩家
        self.current_player = 1 - self.current_player
    
    def handle_roulette_event(self, event, current_player, other_player):
        """处理轮盘事件效果"""
        effect = event['effect']
        
        if effect == 'sweet_time':
            # 甜蜜时光：双方都获得爱情值和金钱
            current_player['love_points'] += 30
            other_player['love_points'] += 20
            current_player['money'] += 1000
            other_player['money'] += 500
            self.add_enhanced_log(f"💕 甜蜜时光！{current_player['name']} 获得30爱情值和1000元，{other_player['name']} 获得20爱情值和500元！")
            
        elif effect == 'small_fight':
            # 小争吵：当前玩家失去爱情值，对方获得同情分
            current_player['love_points'] -= 20
            other_player['love_points'] += 10
            current_player['money'] -= 500
            self.add_enhanced_log(f"💔 小争吵！{current_player['name']} 失去20爱情值和500元，{other_player['name']} 获得10爱情值！")
            
        elif effect == 'surprise_gift':
            # 惊喜礼物：获得道具卡和爱情值
            gift_cards = ["幸运星", "爱情护盾", "时间加速器", "投资折扣卡"]
            gift_card = random.choice(gift_cards)
            current_player['cards'].append(gift_card)
            current_player['love_points'] += 25
            self.add_enhanced_log(f"🎁 惊喜礼物！{current_player['name']} 获得道具卡'{gift_card}'和25爱情值！")
            
        elif effect == 'date_expense':
            # 约会消费：花钱但获得爱情值
            expense = random.randint(800, 1500)
            current_player['money'] -= expense
            current_player['love_points'] += 15
            other_player['love_points'] += 15
            self.add_enhanced_log(f"💸 约会消费！花费{expense}元，双方各获得15爱情值！")
            
        elif effect == 'joint_finance':
            # 共同理财：双方都获得金钱
            profit = random.randint(1000, 2500)
            current_player['money'] += profit
            other_player['money'] += profit // 2
            self.add_enhanced_log(f"💰 共同理财！{current_player['name']} 获得{profit}元，{other_player['name']} 获得{profit//2}元！")
            
        elif effect == 'romantic_confession':
            # 浪漫表白：大量爱情值奖励
            current_player['love_points'] += 50
            other_player['love_points'] += 30
            current_player['relationship_level'] += 1
            self.add_enhanced_log(f"🌹 浪漫表白！{current_player['name']} 获得50爱情值，{other_player['name']} 获得30爱情值，关系等级+1！")
            
        elif effect == 'role_play':
            # 角色扮演：有趣的互动
            current_player['love_points'] += 20
            other_player['love_points'] += 20
            fun_bonus = random.randint(500, 1000)
            current_player['money'] += fun_bonus
            self.add_enhanced_log(f"🎭 角色扮演！双方各获得20爱情值，{current_player['name']} 额外获得{fun_bonus}元！")
            
        elif effect == 'candlelight_dinner':
            # 烛光晚餐：浪漫加成
            current_player['love_points'] += 35
            other_player['love_points'] += 25
            current_player['money'] -= 800  # 晚餐费用
            self.add_enhanced_log(f"🍽️ 烛光晚餐！{current_player['name']} 获得35爱情值，{other_player['name']} 获得25爱情值，花费800元！")
            
        elif effect == 'proposal_surprise':
            # 求婚惊喜：最高奖励
            current_player['love_points'] += 100
            other_player['love_points'] += 80
            current_player['relationship_level'] += 2
            other_player['relationship_level'] += 1
            # 获得特殊道具
            current_player['cards'].append("💍 求婚戒指")
            self.add_enhanced_log(f"💍 求婚惊喜！{current_player['name']} 获得100爱情值和求婚戒指，{other_player['name']} 获得80爱情值，关系等级大幅提升！")
            
        elif effect == 'amusement_park':
            # 游乐园约会：欢乐时光
            current_player['love_points'] += 25
            other_player['love_points'] += 25
            # 有机会获得额外回合
            if random.randint(1, 100) <= 30:
                self.add_enhanced_log(f"🎪 游乐园约会！双方各获得25爱情值，{current_player['name']} 太开心了，获得额外回合！")
                self.current_player = 1 - self.current_player  # 取消玩家切换
            else:
                self.add_enhanced_log(f"🎪 游乐园约会！双方各获得25爱情值！")
        
        # 确保爱情值不为负
        for player in self.players:
            if player['love_points'] < 0:
                player['love_points'] = 0
            if player['money'] < 0:
                player['money'] = 0
    
    def enhanced_roll_dice(self):
        """增强版掷骰子（保留兼容性）"""
        self.spin_couple_roulette()
        if self.current_player == 0:
            self.game_round += 1
            self.round_label.config(text=f"第 {self.game_round} 回合")
        
        self.update_current_player_display()
    
    def handle_enhanced_position(self):
        """处理增强版位置事件"""
        current_player = self.players[self.current_player]
        position = current_player['position']
        prop = self.properties[position]
        
        if prop['type'] == 'property':
            self.handle_enhanced_property(position)
        elif prop['type'] == 'chance':
            self.draw_enhanced_chance_card()
        elif prop['type'] == 'fate':
            self.draw_enhanced_fate_card()
        elif prop['type'] == 'tax':
            tax_amount = prop['rent']
            current_player['money'] -= tax_amount
            self.add_enhanced_log(f"💸 {current_player['name']} 缴纳了 {tax_amount}元 税费！")
        elif prop['type'] == 'station':
            self.handle_station(position)
        
        # 爱情加成
        if prop['love_bonus'] > 0:
            bonus = prop['love_bonus']
            if self.weather == "🌸春天":
                bonus *= 2
                self.add_enhanced_log(f"🌸 春天效果：爱情值获得翻倍！")
            
            current_player['love_points'] += bonus
            self.add_enhanced_log(f"💕 {current_player['name']} 获得了 {bonus} 爱情值！")
    
    def handle_enhanced_property(self, prop_id):
        """处理增强版地产"""
        current_player = self.players[self.current_player]
        prop = self.properties[prop_id]
        
        if prop['owner'] is None:
            # 可以购买
            price = prop['price']
            
            # 天气效果
            if self.weather == "🍂秋天":
                price = int(price * 0.9)
                self.add_enhanced_log(f"🍂 秋天效果：地产价格-10%！")
            
            # 投资优惠卡效果
            discount = 0
            if "投资优惠卡" in current_player['cards']:
                result = messagebox.askyesno("💳 投资优惠卡", f"是否使用投资优惠卡？\n效果：购买 {prop['name']} 享受8折优惠")
                if result:
                    discount = 0.2
                    price = int(price * 0.8)
                    current_player['cards'].remove("投资优惠卡")
                    self.add_enhanced_log(f"💳 {current_player['name']} 使用了投资优惠卡！")
            
            if current_player['money'] >= price:
                result = messagebox.askyesno("🏠 购买地产", 
                    f"是否购买 {prop['name']}？\n" +
                    f"价格: {price}元\n" +
                    f"租金: {prop['rent']}元\n" +
                    f"爱情加成: +{prop['love_bonus']}\n" +
                    f"特殊效果: {prop['special_effect']}")
                
                if result:
                    current_player['money'] -= price
                    current_player['properties'].append(prop_id)
                    prop['owner'] = self.current_player
                    
                    self.add_enhanced_log(f"🏠 {current_player['name']} 购买了 {prop['name']}！")
                    
                    # 检查地产协同效应
                    self.check_property_synergy(prop_id)
                    
                    # 触发爱情任务
                    self.trigger_love_task(prop['name'])
            else:
                self.add_enhanced_log(f"💸 {current_player['name']} 资金不足，无法购买 {prop['name']}！")
        
        else:
            # 需要付租金
            owner = self.players[prop['owner']]
            rent = prop['rent'] * (1 + prop['level'] * 0.5)
            
            # 爱情护盾效果
            if "爱情护盾" in current_player['cards']:
                result = messagebox.askyesno("🛡️ 爱情护盾", f"是否使用爱情护盾？\n效果：免除本次租金 {int(rent)}元")
                if result:
                    current_player['cards'].remove("爱情护盾")
                    self.add_enhanced_log(f"🛡️ {current_player['name']} 使用了爱情护盾，免除租金！")
                    return
            
            # 特殊效果：租金翻倍
            if "租金翻倍" in owner['special_effects']:
                rent *= 2
                owner['special_effects'].remove("租金翻倍")
                self.add_enhanced_log(f"💕 爱情大爆发！租金翻倍！")
            
            current_player['money'] -= int(rent)
            owner['money'] += int(rent)
            
            self.add_enhanced_log(f"🏠 {current_player['name']} 向 {owner['name']} 支付了 {int(rent)}元 租金！")
    
    def check_property_synergy(self, prop_id):
        """检查地产协同效应"""
        current_player = self.players[self.current_player]
        prop = self.properties[prop_id]
        
        # 检查是否拥有关联地产
        owned_linked = []
        for linked_id in prop['linked_properties']:
            if linked_id in current_player['properties']:
                owned_linked.append(self.properties[linked_id]['name'])
        
        if owned_linked:
            bonus_money = len(owned_linked) * 1000
            bonus_love = len(owned_linked) * 20
            
            current_player['money'] += bonus_money
            current_player['love_points'] += bonus_love
            
            self.add_enhanced_log(f"🔗 地产协同效应！{current_player['name']} 获得 {bonus_money}元 和 {bonus_love}爱情值！")
            self.add_enhanced_log(f"   关联地产: {', '.join(owned_linked)}")
    
    def draw_enhanced_chance_card(self):
        """抽取增强版机会卡"""
        card = random.choice(self.chance_cards)
        self.add_enhanced_log(f"🎁 机会卡: {card['text']}")
        self.apply_enhanced_card_effect(card)
    
    def draw_enhanced_fate_card(self):
        """抽取增强版命运卡"""
        card = random.choice(self.fate_cards)
        self.add_enhanced_log(f"🔮 命运卡: {card['text']}")
        self.apply_enhanced_card_effect(card)
    
    def apply_enhanced_card_effect(self, card):
        """应用增强版卡片效果"""
        current_player = self.players[self.current_player]
        effect = card['effect']
        value = card['value']
        
        if effect == 'money':
            current_player['money'] += value
            if value > 0:
                # 晴天效果
                if self.weather == "☀️晴天":
                    bonus = int(value * 0.2)
                    current_player['money'] += bonus
                    self.add_enhanced_log(f"☀️ 晴天效果：额外获得 {bonus}元！")
        
        elif effect == 'card':
            cards = ["幸运星", "爱情护盾", "时间加速器", "投资优惠卡"]
            for _ in range(value):
                new_card = random.choice(cards)
                current_player['cards'].append(new_card)
                self.add_enhanced_log(f"🎴 获得道具卡: {new_card}")
        
        elif effect == 'teleport':
            self.show_teleport_dialog()
        
        elif effect == 'special':
            if value not in current_player['special_effects']:
                current_player['special_effects'].append(value)
            self.apply_special_effect(value)
        
        elif effect == 'upgrade':
            if current_player['properties']:
                prop_id = random.choice(current_player['properties'])
                if self.properties[prop_id]['level'] < 5:
                    self.properties[prop_id]['level'] += 1
                    self.add_enhanced_log(f"⭐ {self.properties[prop_id]['name']} 升级到等级 {self.properties[prop_id]['level']}！")
        
        elif effect == 'relationship':
            current_player['relationship_level'] += value
            self.add_enhanced_log(f"💑 关系等级提升到 {current_player['relationship_level']}级！")
        
        elif effect == 'all_love':
            for player in self.players:
                player['love_points'] += value
            self.add_enhanced_log(f"🌈 所有玩家都获得了 {value} 爱情值！")
        
        elif effect == 'swap':
            # 交换位置
            pos1 = self.players[0]['position']
            pos2 = self.players[1]['position']
            self.players[0]['position'] = pos2
            self.players[1]['position'] = pos1
            self.add_enhanced_log(f"🎭 {self.players[0]['name']} 和 {self.players[1]['name']} 交换了位置！")
        
        elif effect == 'position':
            current_player['position'] = value
            self.add_enhanced_log(f"🎪 {current_player['name']} 移动到了 {self.properties[value]['name']}！")
        
        elif effect == 'love':
            current_player['love_points'] += value
        
        elif effect == 'special_event':
            self.handle_special_event()
        
        # 爱情值加成
        if card['love_bonus'] != 0:
            current_player['love_points'] += card['love_bonus']
    
    def show_teleport_dialog(self):
        """显示传送对话框"""
        teleport_window = tk.Toplevel(self.root)
        teleport_window.title("🌟 传送选择")
        teleport_window.geometry("400x500")
        teleport_window.configure(bg='#ffeef8')
        
        tk.Label(teleport_window, text="🌟 选择传送目的地 🌟", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        # 创建滚动框
        canvas = tk.Canvas(teleport_window, bg='#ffeef8')
        scrollbar = tk.Scrollbar(teleport_window, orient="vertical", command=canvas.yview)
        scrollable_frame = tk.Frame(canvas, bg='#ffeef8')
        
        scrollable_frame.bind(
            "<Configure>",
            lambda e: canvas.configure(scrollregion=canvas.bbox("all"))
        )
        
        canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
        canvas.configure(yscrollcommand=scrollbar.set)
        
        # 添加地块选项
        for i, prop in enumerate(self.properties):
            if prop['type'] == 'property':
                btn_text = f"{prop['name']} - {prop['special_effect']}"
                tk.Button(scrollable_frame, text=btn_text, 
                         command=lambda pos=i: self.teleport_to(pos, teleport_window),
                         font=('Arial', 10), bg='#4CAF50', fg='white', width=35).pack(pady=2)
        
        canvas.pack(side="left", fill="both", expand=True, padx=20, pady=20)
        scrollbar.pack(side="right", fill="y")
    
    def teleport_to(self, position, window):
        """传送到指定位置"""
        current_player = self.players[self.current_player]
        current_player['position'] = position
        
        self.add_enhanced_log(f"🌟 {current_player['name']} 传送到了 {self.properties[position]['name']}！")
        window.destroy()
        
        # 处理传送后的位置事件
        self.handle_enhanced_position()
    
    def trigger_love_task(self, property_name):
        """触发爱情任务"""
        current_player = self.players[self.current_player]
        
        for task in self.love_tasks:
            if not task['completed']:
                # 检查任务触发条件
                triggered = False
                if task['name'] == "🌹 送花表白" and "玫瑰花园" in property_name:
                    triggered = True
                elif task['name'] == "💍 求婚仪式" and "教堂" in property_name:
                    triggered = True
                elif task['name'] == "🍽️ 浪漫晚餐" and "烛光晚餐" in property_name:
                    triggered = True
                elif task['name'] == "🎭 看戏约会" and "剧院" in property_name:
                    triggered = True
                elif task['name'] == "🎢 游乐园约会" and "游乐园" in property_name:
                    triggered = True
                
                if triggered:
                    result = messagebox.askyesno("💕 爱情任务", 
                        f"触发爱情任务: {task['name']}\n" +
                        f"任务描述: {task['desc']}\n" +
                        f"完成奖励: {task['reward']} 爱情值\n\n" +
                        f"是否完成这个任务？")
                    
                    if result:
                        task['completed'] = True
                        current_player['love_points'] += task['reward']
                        self.game_stats['love_tasks_completed'] += 1
                        
                        self.add_enhanced_log(f"💕 {current_player['name']} 完成了爱情任务: {task['name']}！")
                        self.add_enhanced_log(f"💕 获得 {task['reward']} 爱情值奖励！")
                    break
    
    def handle_station(self, station_id):
        """处理车站"""
        current_player = self.players[self.current_player]
        station = self.properties[station_id]
        
        if station['owner'] is None:
            # 可以购买车站
            price = station['price']
            if current_player['money'] >= price:
                result = messagebox.askyesno("🚗 购买车站", 
                    f"是否购买 {station['name']}？\n" +
                    f"价格: {price}元\n" +
                    f"效果: {station['special_effect']}")
                
                if result:
                    current_player['money'] -= price
                    current_player['properties'].append(station_id)
                    station['owner'] = self.current_player
                    
                    self.add_enhanced_log(f"🚗 {current_player['name']} 购买了 {station['name']}！")
        else:
            # 支付过路费
            owner = self.players[station['owner']]
            fee = station['rent']
            
            current_player['money'] -= fee
            owner['money'] += fee
            
            self.add_enhanced_log(f"🚗 {current_player['name']} 向 {owner['name']} 支付了 {fee}元 过路费！")
    
    def view_enhanced_assets(self):
        """查看增强版资产"""
        current_player = self.players[self.current_player]
        
        assets_window = tk.Toplevel(self.root)
        assets_window.title(f"📊 {current_player['name']} 的资产")
        assets_window.geometry("600x500")
        assets_window.configure(bg='#ffeef8')
        
        # 创建标签页
        notebook = ttk.Notebook(assets_window)
        notebook.pack(fill=tk.BOTH, expand=True, padx=20, pady=20)
        
        # 基本信息页
        basic_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(basic_frame, text="💰 基本信息")
        
        basic_info = f"💰 现金: {current_player['money']:,}元\n"
        basic_info += f"💕 爱情值: {current_player['love_points']}\n"
        basic_info += f"💑 关系等级: {current_player['relationship_level']}级\n"
        basic_info += f"🎴 道具卡数量: {len(current_player['cards'])}张\n\n"
        
        # 计算总资产
        total_assets = current_player['money']
        for prop_id in current_player['properties']:
            prop = self.properties[prop_id]
            total_assets += prop['price'] * (1 + prop['level'] * 0.3)
        
        basic_info += f"📈 总资产估值: {total_assets:,.0f}元"
        
        tk.Label(basic_frame, text=basic_info, font=('Arial', 12), bg='#ffeef8', justify=tk.LEFT).pack(pady=20)
        
        # 地产页
        property_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(property_frame, text="🏠 地产")
        
        property_text = tk.Text(property_frame, font=('Arial', 11), bg='white', wrap=tk.WORD)
        property_text.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
        
        if current_player['properties']:
            for prop_id in current_player['properties']:
                prop = self.properties[prop_id]
                prop_info = f"🏠 {prop['name']}\n"
                prop_info += f"   价格: {prop['price']}元\n"
                prop_info += f"   租金: {prop['rent']}元\n"
                prop_info += f"   等级: {prop['level']}\n"
                prop_info += f"   爱情加成: +{prop['love_bonus']}\n"
                prop_info += f"   特殊效果: {prop['special_effect']}\n\n"
                property_text.insert(tk.END, prop_info)
        else:
            property_text.insert(tk.END, "暂无地产")
        
        property_text.config(state=tk.DISABLED)
        
        # 道具卡页
        cards_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(cards_frame, text="🎴 道具卡")
        
        cards_text = tk.Text(cards_frame, font=('Arial', 11), bg='white', wrap=tk.WORD)
        cards_text.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
        
        if current_player['cards']:
            effects = {
                "幸运星": "立即获得3000元和30爱情值",
                "爱情护盾": "免除一次租金支付",
                "时间加速器": "下次掷骰子点数+3",
                "投资折扣卡": "购买地产享受8折优惠",
                "💍 求婚戒指": "特殊道具，象征永恒的爱情"
            }
            
            for card in current_player['cards']:
                effect_desc = effects.get(card, "未知效果")
                card_info = f"🎴 {card}\n   效果: {effect_desc}\n\n"
                cards_text.insert(tk.END, card_info)
        else:
            cards_text.insert(tk.END, "暂无道具卡")
        
        cards_text.config(state=tk.DISABLED)
    
    def use_enhanced_items(self):
        """使用增强版道具"""
        current_player = self.players[self.current_player]
        
        if not current_player['cards']:
            messagebox.showinfo("🎴 道具卡", "您没有可使用的道具卡！")
            return
        
        items_window = tk.Toplevel(self.root)
        items_window.title("🎴 使用道具卡")
        items_window.geometry("500x400")
        items_window.configure(bg='#ffeef8')
        
        tk.Label(items_window, text="🎴 选择要使用的道具卡 🎴", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        # 统计道具卡数量
        card_counts = {}
        for card in current_player['cards']:
            card_counts[card] = card_counts.get(card, 0) + 1
        
        for card, count in card_counts.items():
            card_frame = tk.Frame(items_window, bg='white', relief=tk.RAISED, bd=2)
            card_frame.pack(fill=tk.X, padx=20, pady=5)
            
            card_info = f"{card} x{count}"
            tk.Label(card_frame, text=card_info, font=('Arial', 12, 'bold'), bg='white').pack(side=tk.LEFT, padx=10, pady=5)
            
            tk.Button(card_frame, text="使用", 
                     command=lambda c=card: self.use_specific_item(c, items_window),
                     font=('Arial', 10), bg='#4CAF50', fg='white').pack(side=tk.RIGHT, padx=10, pady=5)
    
    def use_specific_item(self, card_name, window):
        """使用特定道具"""
        current_player = self.players[self.current_player]
        
        if card_name not in current_player['cards']:
            messagebox.showerror("错误", "您没有这张道具卡！")
            return
        
        # 道具效果
        effects = {
            "幸运星": "立即获得3000元和30爱情值",
            "爱情护盾": "免除一次租金支付",
            "时间加速器": "下次掷骰子点数+3",
            "投资优惠卡": "购买地产享受8折优惠"
        }
        
        effect_desc = effects.get(card_name, "未知效果")
        
        result = messagebox.askyesno("🎴 使用道具卡", 
            f"确定要使用 {card_name} 吗？\n\n" +
            f"效果: {effect_desc}")
        
        if result:
            current_player['cards'].remove(card_name)
            
            if card_name == "幸运星":
                current_player['money'] += 3000
                current_player['love_points'] += 30
                self.add_enhanced_log(f"⭐ {current_player['name']} 使用了幸运星，获得3000元和30爱情值！")
            
            elif card_name == "爱情护盾":
                current_player['special_effects'].append("爱情护盾")
                self.add_enhanced_log(f"🛡️ {current_player['name']} 激活了爱情护盾！")
            
            elif card_name == "时间加速器":
                current_player['special_effects'].append("时间加速器")
                self.add_enhanced_log(f"⚡ {current_player['name']} 准备使用时间加速器！")
            
            elif card_name == "投资优惠卡":
                current_player['special_effects'].append("投资优惠卡")
                self.add_enhanced_log(f"💳 {current_player['name']} 准备使用投资优惠卡！")
            
            self.update_enhanced_display()
            window.destroy()
    
    def manage_enhanced_properties(self):
        """管理增强版地产"""
        current_player = self.players[self.current_player]
        
        if not current_player['properties']:
            messagebox.showinfo("🏠 地产管理", "您还没有任何地产！")
            return
        
        manage_window = tk.Toplevel(self.root)
        manage_window.title("🏠 地产管理")
        manage_window.geometry("700x600")
        manage_window.configure(bg='#ffeef8')
        
        # 创建标签页
        notebook = ttk.Notebook(manage_window)
        notebook.pack(fill=tk.BOTH, expand=True, padx=20, pady=20)
        
        # 升级地产页
        upgrade_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(upgrade_frame, text="⭐ 升级地产")
        
        tk.Label(upgrade_frame, text="⭐ 升级地产 ⭐", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        for prop_id in current_player['properties']:
            prop = self.properties[prop_id]
            if prop['level'] < 5:  # 最高5级
                upgrade_cost = prop['price'] * 0.5 * (prop['level'] + 1)
                
                # 雪天效果
                if self.weather == "❄️雪天":
                    upgrade_cost *= 0.5
                    weather_text = " (雪天半价！)"
                else:
                    weather_text = ""
                
                prop_frame = tk.Frame(upgrade_frame, bg='white', relief=tk.RAISED, bd=2)
                prop_frame.pack(fill=tk.X, padx=20, pady=5)
                
                info_text = f"{prop['name']} (等级{prop['level']}) - 升级费用: {upgrade_cost:.0f}元{weather_text}"
                tk.Label(prop_frame, text=info_text, font=('Arial', 11), bg='white').pack(side=tk.LEFT, padx=10, pady=5)
                
                tk.Button(prop_frame, text="升级", 
                         command=lambda pid=prop_id, cost=upgrade_cost: self.upgrade_property(pid, cost),
                         font=('Arial', 10), bg='#FF9800', fg='white').pack(side=tk.RIGHT, padx=10, pady=5)
        
        # 抵押地产页
        mortgage_frame = tk.Frame(notebook, bg='#ffeef8')
        notebook.add(mortgage_frame, text="💰 抵押地产")
        
        tk.Label(mortgage_frame, text="💰 抵押地产 💰", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        for prop_id in current_player['properties']:
            prop = self.properties[prop_id]
            mortgage_value = prop['price'] * 0.7
            
            prop_frame = tk.Frame(mortgage_frame, bg='white', relief=tk.RAISED, bd=2)
            prop_frame.pack(fill=tk.X, padx=20, pady=5)
            
            info_text = f"{prop['name']} - 抵押价值: {mortgage_value:.0f}元"
            tk.Label(prop_frame, text=info_text, font=('Arial', 11), bg='white').pack(side=tk.LEFT, padx=10, pady=5)
            
            tk.Button(prop_frame, text="抵押", 
                     command=lambda pid=prop_id, value=mortgage_value: self.mortgage_property(pid, value),
                     font=('Arial', 10), bg='#f44336', fg='white').pack(side=tk.RIGHT, padx=10, pady=5)
    
    def upgrade_property(self, prop_id, cost):
        """升级地产"""
        current_player = self.players[self.current_player]
        prop = self.properties[prop_id]
        
        if current_player['money'] >= cost:
            current_player['money'] -= int(cost)
            prop['level'] += 1
            prop['rent'] = int(prop['rent'] * 1.5)  # 租金增加50%
            
            self.add_enhanced_log(f"⭐ {current_player['name']} 将 {prop['name']} 升级到等级 {prop['level']}！")
            self.update_enhanced_display()
        else:
            messagebox.showerror("💸 资金不足", f"升级需要 {cost:.0f}元，您的资金不足！")
    
    def mortgage_property(self, prop_id, value):
        """抵押地产"""
        current_player = self.players[self.current_player]
        prop = self.properties[prop_id]
        
        result = messagebox.askyesno("💰 抵押确认", 
            f"确定要抵押 {prop['name']} 吗？\n" +
            f"您将获得 {value:.0f}元\n" +
            f"该地产将被移除")
        
        if result:
            current_player['money'] += int(value)
            current_player['properties'].remove(prop_id)
            prop['owner'] = None
            prop['level'] = 0
            
            self.add_enhanced_log(f"💰 {current_player['name']} 抵押了 {prop['name']}，获得 {value:.0f}元！")
            self.update_enhanced_display()
    
    def handle_special_event(self):
        """处理特殊事件"""
        events = [
            {"name": "💕 爱情奇迹", "desc": "爱情的力量让你们更加亲密！", "effect": "love_miracle"},
            {"name": "🏆 成就解锁", "desc": "解锁一个随机成就！", "effect": "achievement_unlock"},
            {"name": "🌟 许愿池", "desc": "在许愿池许下心愿！", "effect": "wish"},
            {"name": "🎁 神秘礼物", "desc": "收到一份神秘礼物！", "effect": "mystery_gift"}
        ]
        
        event = random.choice(events)
        self.add_enhanced_log(f"✨ 特殊事件: {event['name']} - {event['desc']}")
        
        if event['effect'] == 'love_miracle':
            self.love_miracle_event()
        elif event['effect'] == 'achievement_unlock':
            self.achievement_unlock_event()
        elif event['effect'] == 'wish':
            self.wish_event()
        elif event['effect'] == 'mystery_gift':
            self.mystery_gift_event()
    
    def love_miracle_event(self):
        """爱情奇迹事件"""
        for player in self.players:
            player['love_points'] += 100
            player['relationship_level'] += 1
        
        self.add_enhanced_log(f"💕 爱情奇迹！所有玩家获得100爱情值，关系等级+1！")
    
    def achievement_unlock_event(self):
        """成就解锁事件"""
        locked_achievements = [ach for ach in self.achievements if not ach['unlocked']]
        if locked_achievements:
            achievement = random.choice(locked_achievements)
            achievement['unlocked'] = True
            
            current_player = self.players[self.current_player]
            current_player['achievements'].append(achievement['name'])
            current_player['love_points'] += 50
            
            self.add_enhanced_log(f"🏆 解锁成就: {achievement['name']} - {achievement['desc']}！")
    
    def wish_event(self):
        """许愿事件"""
        wishes = [
            {"name": "💰 财富之愿", "effect": "money", "value": 5000},
            {"name": "💕 爱情之愿", "effect": "love", "value": 80},
            {"name": "🏠 地产之愿", "effect": "property_discount", "value": 0.5},
            {"name": "⭐ 升级之愿", "effect": "free_upgrade", "value": 1}
        ]
        
        wish_window = tk.Toplevel(self.root)
        wish_window.title("🌟 许愿池")
        wish_window.geometry("400x300")
        wish_window.configure(bg='#ffeef8')
        
        tk.Label(wish_window, text="🌟 在许愿池许下心愿 🌟", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        for wish in wishes:
            tk.Button(wish_window, text=wish['name'], 
                     command=lambda w=wish: self.fulfill_wish(w, wish_window),
                     font=('Arial', 12), bg='#9C27B0', fg='white', width=20).pack(pady=5)
    
    def fulfill_wish(self, wish, window):
        """实现愿望"""
        current_player = self.players[self.current_player]
        
        if wish['effect'] == 'money':
            current_player['money'] += wish['value']
            self.add_enhanced_log(f"💰 {current_player['name']} 许愿获得 {wish['value']}元！")
        
        elif wish['effect'] == 'love':
            current_player['love_points'] += wish['value']
            self.add_enhanced_log(f"💕 {current_player['name']} 许愿获得 {wish['value']} 爱情值！")
        
        elif wish['effect'] == 'property_discount':
            current_player['special_effects'].append("地产半价")
            self.add_enhanced_log(f"🏠 {current_player['name']} 许愿获得地产半价购买机会！")
        
        elif wish['effect'] == 'free_upgrade':
            if current_player['properties']:
                prop_id = random.choice(current_player['properties'])
                if self.properties[prop_id]['level'] < 5:
                    self.properties[prop_id]['level'] += 1
                    self.add_enhanced_log(f"⭐ {current_player['name']} 许愿免费升级了 {self.properties[prop_id]['name']}！")
        
        window.destroy()
        self.update_enhanced_display()
    
    def mystery_gift_event(self):
        """神秘礼物事件"""
        current_player = self.players[self.current_player]
        
        gifts = [
            {"name": "💎 钻石", "money": 3000, "love": 50},
            {"name": "🌹 玫瑰花束", "money": 1000, "love": 80},
            {"name": "🎁 惊喜盒子", "money": 2000, "love": 60},
            {"name": "💍 戒指", "money": 5000, "love": 100}
        ]
        
        gift = random.choice(gifts)
        current_player['money'] += gift['money']
        current_player['love_points'] += gift['love']
        
        self.add_enhanced_log(f"🎁 {current_player['name']} 收到神秘礼物: {gift['name']}！")
        self.add_enhanced_log(f"   获得 {gift['money']}元 和 {gift['love']} 爱情值！")
    
    def apply_special_effect(self, effect):
        """应用特殊效果"""
        if effect == "租金翻倍":
            self.add_enhanced_log(f"💕 下次收租将获得双倍收益！")
        elif effect == "全体升级":
            current_player = self.players[self.current_player]
            for prop_id in current_player['properties']:
                if self.properties[prop_id]['level'] < 5:
                    self.properties[prop_id]['level'] += 1
            self.add_enhanced_log(f"🌙 月圆之夜！{current_player['name']} 的所有地产都升级了一级！")
    
    def check_achievements(self):
        """检查成就"""
        for player_idx, player in enumerate(self.players):
            for achievement in self.achievements:
                if not achievement['unlocked']:
                    unlocked = False
                    
                    if achievement['condition'] == 'money' and player['money'] >= achievement['value']:
                        unlocked = True
                    elif achievement['condition'] == 'properties' and len(player['properties']) >= achievement['value']:
                        unlocked = True
                    elif achievement['condition'] == 'love' and player['love_points'] >= achievement['value']:
                        unlocked = True
                    elif achievement['condition'] == 'level' and player['relationship_level'] >= achievement['value']:
                        unlocked = True
                    elif achievement['condition'] == 'tasks' and self.game_stats['love_tasks_completed'] >= achievement['value']:
                        unlocked = True
                    
                    if unlocked:
                        achievement['unlocked'] = True
                        player['achievements'].append(achievement['name'])
                        player['love_points'] += 50  # 成就奖励
                        
                        self.add_enhanced_log(f"🏆 {player['name']} 解锁成就: {achievement['name']}！")
    
    def show_achievements(self):
        """显示成就"""
        achievement_text = "🏆 成就系统 🏆\n\n"
        
        for achievement in self.achievements:
            status = "✅" if achievement['unlocked'] else "❌"
            achievement_text += f"{status} {achievement['name']}\n"
            achievement_text += f"   {achievement['desc']}\n\n"
        
        self.achievement_text.delete(1.0, tk.END)
        self.achievement_text.insert(tk.END, achievement_text)
    
    def show_game_stats(self):
        """显示游戏统计"""
        stats_window = tk.Toplevel(self.root)
        stats_window.title("📈 游戏统计")
        stats_window.geometry("500x400")
        stats_window.configure(bg='#ffeef8')
        
        tk.Label(stats_window, text="📈 游戏统计 📈", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        stats_text = f"🎮 游戏回合: {self.game_round}\n"
        stats_text += f"🌤️ 当前天气: {self.weather}\n"
        stats_text += f"🏠 已购买地产: {self.game_stats['properties_bought']}\n"
        stats_text += f"💕 已完成爱情任务: {self.game_stats['love_tasks_completed']}\n\n"
        
        stats_text += "👥 玩家统计:\n\n"
        
        for i, player in enumerate(self.players):
            stats_text += f"{player['avatar']} {player['name']}:\n"
            stats_text += f"   💰 资金: {player['money']:,}元\n"
            stats_text += f"   💕 爱情值: {player['love_points']}\n"
            stats_text += f"   💑 关系等级: {player['relationship_level']}级\n"
            stats_text += f"   🏠 拥有地产: {len(player['properties'])}个\n"
            stats_text += f"   🎴 道具卡: {len(player['cards'])}张\n"
            stats_text += f"   🏆 成就: {len(player['achievements'])}个\n\n"
        
        tk.Label(stats_window, text=stats_text, font=('Arial', 11), bg='#ffeef8', justify=tk.LEFT).pack(pady=20)
    
    def show_game_settings(self):
        """显示游戏设置"""
        settings_window = tk.Toplevel(self.root)
        settings_window.title("⚙️ 游戏设置")
        settings_window.geometry("400x300")
        settings_window.configure(bg='#ffeef8')
        
        tk.Label(settings_window, text="⚙️ 游戏设置 ⚙️", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        # 玩家名称设置
        name_frame = tk.Frame(settings_window, bg='#ffeef8')
        name_frame.pack(pady=10)
        
        tk.Label(name_frame, text="玩家名称:", font=('Arial', 12), bg='#ffeef8').pack()
        
        for i, player in enumerate(self.players):
            player_frame = tk.Frame(name_frame, bg='#ffeef8')
            player_frame.pack(pady=5)
            
            tk.Label(player_frame, text=f"玩家{i+1}:", font=('Arial', 10), bg='#ffeef8').pack(side=tk.LEFT)
            
            name_entry = tk.Entry(player_frame, font=('Arial', 10))
            name_entry.insert(0, player['name'])
            name_entry.pack(side=tk.LEFT, padx=5)
            
            tk.Button(player_frame, text="更改", 
                     command=lambda idx=i, entry=name_entry: self.change_player_name(idx, entry),
                     font=('Arial', 8), bg='#4CAF50', fg='white').pack(side=tk.LEFT, padx=5)
        
        # 天气设置
        weather_frame = tk.Frame(settings_window, bg='#ffeef8')
        weather_frame.pack(pady=20)
        
        tk.Label(weather_frame, text="天气设置:", font=('Arial', 12), bg='#ffeef8').pack()
        
        weathers = ["☀️晴天", "🌧️雨天", "❄️雪天", "🌸春天", "🍂秋天"]
        for weather in weathers:
            tk.Button(weather_frame, text=weather, 
                     command=lambda w=weather: self.change_weather(w),
                     font=('Arial', 10), bg='#2196F3', fg='white', width=8).pack(side=tk.LEFT, padx=2)
    
    def change_player_name(self, player_idx, entry):
        """更改玩家名称"""
        new_name = entry.get().strip()
        if new_name:
            old_name = self.players[player_idx]['name']
            self.players[player_idx]['name'] = new_name
            
            self.add_enhanced_log(f"📝 {old_name} 更名为 {new_name}")
            self.update_enhanced_display()
    
    def change_weather(self, new_weather):
        """更改天气"""
        old_weather = self.weather
        self.weather = new_weather
        self.season_effect = self.get_season_effect()
        
        self.weather_label.config(text=f"天气: {self.weather}")
        self.add_enhanced_log(f"🌤️ 天气从 {old_weather} 变为 {new_weather}")
    
    def on_board_click(self, event):
        """棋盘点击事件"""
        x, y = event.x, event.y
        positions = self.get_enhanced_board_positions()
        
        # 查找点击的地块
        for i, (px, py) in enumerate(positions):
            if abs(x - px) <= 35 and abs(y - py) <= 25:
                self.show_property_info(i)
                break
    
    def show_property_info(self, prop_id):
        """显示地块信息"""
        prop = self.properties[prop_id]
        
        info_window = tk.Toplevel(self.root)
        info_window.title(f"📍 {prop['name']}")
        info_window.geometry("400x300")
        info_window.configure(bg='#ffeef8')
        
        tk.Label(info_window, text=f"📍 {prop['name']}", 
                font=('Arial', 16, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        info_text = f"类型: {prop['type']}\n"
        
        if prop['type'] == 'property':
            info_text += f"价格: {prop['price']}元\n"
            info_text += f"租金: {prop['rent']}元\n"
            info_text += f"等级: {prop['level']}\n"
            
            if prop['owner'] is not None:
                owner_name = self.players[prop['owner']]['name']
                info_text += f"拥有者: {owner_name}\n"
            else:
                info_text += "拥有者: 无\n"
        
        info_text += f"爱情加成: +{prop['love_bonus']}\n"
        info_text += f"特殊效果: {prop['special_effect']}\n"
        
        if prop['linked_properties']:
            linked_names = [self.properties[lid]['name'] for lid in prop['linked_properties']]
            info_text += f"关联地产: {', '.join(linked_names)}\n"
        
        tk.Label(info_window, text=info_text, font=('Arial', 11), bg='#ffeef8', justify=tk.LEFT).pack(pady=20)
    
    def add_enhanced_log(self, message):
        """添加增强版游戏记录"""
        timestamp = datetime.now().strftime("%H:%M:%S")
        log_entry = f"[{timestamp}] {message}\n"
        
        self.game_log.append(log_entry)
        
        # 保持日志长度
        if len(self.game_log) > 100:
            self.game_log = self.game_log[-100:]
        
        # 更新显示
        self.log_text.insert(tk.END, log_entry)
        self.log_text.see(tk.END)
    
    def update_enhanced_display(self):
        """更新增强版显示"""
        # 更新玩家信息
        for i, player in enumerate(self.players):
            info_text = self.player_info_frames[i]
            info_text.delete(1.0, tk.END)
            
            player_info = f"💰 资金: {player['money']:,}元\n"
            player_info += f"💕 爱情值: {player['love_points']}\n"
            player_info += f"💑 关系等级: {player['relationship_level']}级\n"
            player_info += f"📍 位置: {self.properties[player['position']]['name']}\n"
            player_info += f"🏠 地产数量: {len(player['properties'])}\n"
            player_info += f"🎴 道具卡: {len(player['cards'])}张\n"
            
            if player['special_effects']:
                player_info += f"✨ 特殊效果: {', '.join(player['special_effects'])}\n"
            
            info_text.insert(tk.END, player_info)
        
        # 更新成就显示
        self.show_achievements()
        
        # 重绘棋盘
        self.draw_enhanced_board()
    
    def update_current_player_display(self):
        """更新当前玩家显示"""
        current_player = self.players[self.current_player]
        self.current_player_indicator.config(
            text=f"🎯 轮到: {current_player['name']}",
            fg='white'
        )
        
        # 更新当前玩家道具显示
        if current_player['cards']:
            items_text = f"🎴 道具: {', '.join(current_player['cards'][:3])}"  # 最多显示3个道具
            if len(current_player['cards']) > 3:
                items_text += f" (+{len(current_player['cards'])-3})"
        else:
            items_text = "🎴 道具: 无"
        
        self.current_player_items.config(text=items_text)
    
    def check_enhanced_game_over(self):
        """检查增强版游戏结束"""
        # 检查破产
        for i, player in enumerate(self.players):
            if player['money'] < 0:
                self.show_enhanced_game_over(1 - i)  # 另一个玩家获胜
                return True
        
        # 检查回合数限制
        if self.game_round > 50:
            self.show_enhanced_game_over_by_score()
            return True
        
        return False
    
    def show_enhanced_game_over(self, winner_idx):
        """显示增强版游戏结束"""
        winner = self.players[winner_idx]
        loser = self.players[1 - winner_idx]
        
        result_window = tk.Toplevel(self.root)
        result_window.title("🎉 游戏结束")
        result_window.geometry("500x400")
        result_window.configure(bg='#ffeef8')
        
        tk.Label(result_window, text="🎉 游戏结束 🎉", 
                font=('Arial', 20, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        tk.Label(result_window, text=f"🏆 获胜者: {winner['name']} {winner['avatar']}", 
                font=('Arial', 16, 'bold'), fg=winner['color'], bg='#ffeef8').pack(pady=10)
        
        # 最终得分
        winner_score = self.calculate_final_score(winner_idx)
        loser_score = self.calculate_final_score(1 - winner_idx)
        
        score_text = f"📊 最终得分:\n\n"
        score_text += f"{winner['name']}: {winner_score:,.0f}分\n"
        score_text += f"{loser['name']}: {loser_score:,.0f}分\n\n"
        
        score_text += f"🎮 游戏统计:\n"
        score_text += f"总回合数: {self.game_round}\n"
        score_text += f"完成的爱情任务: {self.game_stats['love_tasks_completed']}\n"
        
        tk.Label(result_window, text=score_text, font=('Arial', 12), bg='#ffeef8', justify=tk.LEFT).pack(pady=20)
        
        tk.Button(result_window, text="🔄 重新开始", command=lambda: [result_window.destroy(), self.enhanced_restart_game()],
                 font=('Arial', 14), bg='#4CAF50', fg='white').pack(pady=10)
    
    def show_enhanced_game_over_by_score(self):
        """按分数显示游戏结束"""
        scores = [self.calculate_final_score(i) for i in range(2)]
        winner_idx = 0 if scores[0] > scores[1] else 1
        
        result_window = tk.Toplevel(self.root)
        result_window.title("🎉 游戏结束")
        result_window.geometry("500x400")
        result_window.configure(bg='#ffeef8')
        
        tk.Label(result_window, text="🎉 回合数达到上限！🎉", 
                font=('Arial', 18, 'bold'), fg='#ff69b4', bg='#ffeef8').pack(pady=20)
        
        winner = self.players[winner_idx]
        tk.Label(result_window, text=f"🏆 获胜者: {winner['name']} {winner['avatar']}", 
                font=('Arial', 16, 'bold'), fg=winner['color'], bg='#ffeef8').pack(pady=10)
        
        score_text = f"📊 最终得分:\n\n"
        for i, player in enumerate(self.players):
            score_text += f"{player['name']}: {scores[i]:,.0f}分\n"
        
        tk.Label(result_window, text=score_text, font=('Arial', 12), bg='#ffeef8', justify=tk.LEFT).pack(pady=20)
        
        tk.Button(result_window, text="🔄 重新开始", command=lambda: [result_window.destroy(), self.enhanced_restart_game()],
                 font=('Arial', 14), bg='#4CAF50', fg='white').pack(pady=10)
    
    def calculate_final_score(self, player_idx):
        """计算最终得分"""
        player = self.players[player_idx]
        
        score = player['money']  # 基础资金
        score += player['love_points'] * 10  # 爱情值 x10
        score += player['relationship_level'] * 1000  # 关系等级 x1000
        score += len(player['achievements']) * 2000  # 成就 x2000
        
        # 地产价值
        for prop_id in player['properties']:
            prop = self.properties[prop_id]
            score += prop['price'] * (1 + prop['level'] * 0.3)
        
        return score
    
    def enhanced_restart_game(self):
        """增强版重新开始游戏"""
        result = messagebox.askyesno("🔄 重新开始", "确定要重新开始游戏吗？\n当前进度将会丢失！")
        
        if result:
            # 重置游戏状态
            self.current_player = 0
            self.game_round = 1
            
            # 重置玩家
            for player in self.players:
                player['money'] = 10000
                player['position'] = 0
                player['properties'] = []
                player['cards'] = []
                player['love_points'] = 100
                player['achievements'] = []
                player['special_effects'] = []
                player['relationship_level'] = 1
            
            # 重置地产
            for prop in self.properties:
                prop['owner'] = None
                prop['level'] = 0
            
            # 重置成就
            for achievement in self.achievements:
                achievement['unlocked'] = False
            
            # 重置爱情任务
            for task in self.love_tasks:
                task['completed'] = False
            
            # 重置统计
            self.game_stats = {"rounds": 0, "properties_bought": 0, "love_tasks_completed": 0}
            
            # 重置天气
            self.weather = random.choice(["☀️晴天", "🌧️雨天", "❄️雪天", "🌸春天", "🍂秋天"])
            self.season_effect = self.get_season_effect()
            
            # 清空日志
            self.game_log = []
            self.log_text.delete(1.0, tk.END)
            
            # 更新显示
            self.update_enhanced_display()
            self.update_current_player_display()
            self.weather_label.config(text=f"天气: {self.weather}")
            self.round_label.config(text=f"第 {self.game_round} 回合")
            
            self.add_enhanced_log("🎮 游戏重新开始！")
            self.add_enhanced_log(f"🌤️ 当前天气: {self.weather} - {self.season_effect}")
    
    def run(self):
        """运行游戏"""
        # 显示游戏规则
        messagebox.showinfo("💕 情侣大富翁 - 爱情冒险版 💕", 
            "🎮 游戏规则:\n\n" +
            "1. 🎲 轮流掷骰子移动\n" +
            "2. 🏠 购买地产，收取租金\n" +
            "3. 💕 完成爱情任务，获得爱情值\n" +
            "4. 🎴 使用道具卡，获得特殊效果\n" +
            "5. 🏆 解锁成就，提升关系等级\n" +
            "6. 🌤️ 天气影响游戏效果\n\n" +
            "💰 破产或50回合后游戏结束\n" +
            "🏆 最高分者获胜！\n\n" +
            "💕 祝你们游戏愉快！")
        
        # 初始化显示
        self.update_enhanced_display()
        self.update_current_player_display()
        
        # 添加初始日志
        self.add_enhanced_log("🎮 欢迎来到情侣大富翁 - 爱情冒险版！")
        self.add_enhanced_log(f"🌤️ 当前天气: {self.weather} - {self.season_effect}")
        self.add_enhanced_log(f"🎯 {self.players[0]['name']} 先开始游戏！")
        
        # 启动主循环
        self.root.mainloop()

if __name__ == "__main__":
    game = EnhancedCoupleMonopoly()
    game.run()